import collections
class Solution(object):
    def countPairs(self, n, edges, queries):
        d = collections.defaultdict(int)
        for u, v in edges:
            d[u] += 1
            d[v] += 1
        st = [[num, key] for key, num in d.items()]
        st.sort()
        


data = Solution()
n = 4
edges = [[1,2],[2,4],[1,3],[2,3],[2,1]]
queries = [2,3]
print(data.countPairs(n, edges, queries))